import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";

var _dec, _dec2, _dec3, _class, _class2;

/**
 * FilterForm - 模板头数据表单
 * @since 2019-3-7
 * @version 0.0.1

 */
import React, { PureComponent } from 'react';
import { Button, Col, Form, Input, Row } from 'antd';
import { Bind } from 'lodash-decorators';
import intl from 'utils/intl';
import { FORM_COL_4_LAYOUT, SEARCH_FORM_ITEM_LAYOUT, SEARCH_FORM_ROW_LAYOUT } from 'utils/constants';
var FilterForm = (_dec = Form.create({
  fieldNameProp: null
}), _dec2 = Bind(), _dec3 = Bind(), _dec(_class = (_class2 = /*#__PURE__*/function (_PureComponent) {
  _inherits(FilterForm, _PureComponent);

  var _super = _createSuper(FilterForm);

  function FilterForm() {
    _classCallCheck(this, FilterForm);

    return _super.apply(this, arguments);
  }

  _createClass(FilterForm, [{
    key: "handleSearch",
    value:
    /**
     * 查询
     */
    function handleSearch() {
      var _this$props = this.props,
          _this$props$onSearch = _this$props.onSearch,
          onSearch = _this$props$onSearch === void 0 ? function (e) {
        return e;
      } : _this$props$onSearch,
          form = _this$props.form;
      onSearch(form.getFieldsValue());
    }
    /**
     * 重置
     */

  }, {
    key: "handleFormReset",
    value: function handleFormReset() {
      var form = this.props.form;
      form.resetFields();
    }
  }, {
    key: "render",
    value: function render() {
      var getFieldDecorator = this.props.form.getFieldDecorator;
      return /*#__PURE__*/React.createElement(Form, {
        className: "more-fields-search-form"
      }, /*#__PURE__*/React.createElement(Row, Object.assign({
        type: "flex",
        gutter: 24,
        align: "bottom"
      }, SEARCH_FORM_ROW_LAYOUT), /*#__PURE__*/React.createElement(Col, FORM_COL_4_LAYOUT, /*#__PURE__*/React.createElement(Form.Item, Object.assign({}, SEARCH_FORM_ITEM_LAYOUT, {
        label: intl.get("cimp.template.model.template.columnCode").d('列编码')
      }), getFieldDecorator('columnCode')( /*#__PURE__*/React.createElement(Input, null)))), /*#__PURE__*/React.createElement(Col, FORM_COL_4_LAYOUT, /*#__PURE__*/React.createElement(Form.Item, Object.assign({}, SEARCH_FORM_ITEM_LAYOUT, {
        label: intl.get("cimp.template.model.template.columnName").d('列名')
      }), getFieldDecorator('columnName')( /*#__PURE__*/React.createElement(Input, null)))), /*#__PURE__*/React.createElement(Col, Object.assign({}, FORM_COL_4_LAYOUT, {
        className: "search-btn-more"
      }), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
        onClick: this.handleFormReset
      }, intl.get('cpaas.common.button.reset').d('重置')), /*#__PURE__*/React.createElement(Button, {
        type: "primary",
        htmlType: "submit",
        onClick: this.handleSearch
      }, intl.get('cpaas.common.button.search').d('查询'))))));
    }
  }]);

  return FilterForm;
}(PureComponent), (_applyDecoratedDescriptor(_class2.prototype, "handleSearch", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "handleSearch"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleFormReset", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "handleFormReset"), _class2.prototype)), _class2)) || _class);
export { FilterForm as default };